package cn.tedu.basic;
/*本类用于复习循环*/
public class TestWhile {
    public static void main(String[] args) {
        f1();
        f2();//1....10
        f3();//1+2+3+4+....+10
        f4();//1+3+5+7+...+99
        f5();//1,3,5,7,....99
    }

    private static void f5() {
        int a5 = 1;
        while (a5<100){
            System.out.println(a5);
            a5+=2;
        }
    }

    private static void f4() {
        int sum1 = 0;
        int a3 = 0;
        while (a3<=100){
            sum1+=a3;
            a3+=2;
        }
        System.out.println("2到100所有偶数相加:"+sum1);
    }

    private static void f3() {
        int sum = 0;
        int a2 = 0;
        while (a2<=10){
            sum+=a2;
            a2++;
        }
        System.out.println(sum);
    }

    private static void f2() {
        int a1 = 1;
        while (a1<=10){
            System.out.println(a1);
            a1++;
        }
    }

    private static void f1() {
        int a = 0;
        while (a<10){
            System.out.println("小可爱们,中午好");
            a++;
        }
    }
}
